﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Servey.ascx.cs" Inherits="Controls_Servey" %>
<div class="traffic">
    <script type="text/javascript">
        $(document).ready(function ()
        {
            $("#btnSubmit").click(function ()
            {
                $(".click div input").each(function ()
                {
                    if ($(this).attr("type") == "checkbox")
                    {
                        alert($(this).attr("checked"));
                    }
                    if ($(this).attr("type") == "radio")
                    {
                        if ($(this).attr("checked"))
                        {
                            $.ajax({
                                url: "/services/Admin.asmx/AddVote",
                                type: "POST",
                                dataType: "json",
                                data: "{question_id:" + $("#<%=hdfID.ClientID %>").attr("value") + ",answer_id:" + $(this).attr("title") + "}",
                                contentType: "application/json; charset=utf-8",
                                success: function (msg)
                                {
                                    alert(msg.d);
                                },
                                error: function (e)
                                {
                                    alert(e);
                                }
                            });
                        }


                    }
                });
            });
        });
    </script>
    <h2>
        Thăm dò ý kiến</h2>
    <p id="strQuestion" runat="server">
    </p>
    <asp:HiddenField ID="hdfID" runat="server" />
    <div class="click">
        <asp:Repeater ID="rptControl" runat="server">
            <ItemTemplate>
                <div title="<%#Eval("ANSWER_ID") %>">
                    <%--<input type="radio" name="" class="radio" />--%>
                    <%#getControl(Eval("CONTROL_NAME").ToString(), Eval("ANSWER_ID").ToString())%>
                    <span>
                        <%#Eval("ANSWER_TEXT")%></span>
                </div>
            </ItemTemplate>
        </asp:Repeater>
        <div>
            <input type="button" value="Biểu quyết" class="button1" name="" id="btnSubmit" />
            <input type="button" value="Kết quả" class="button2" name="" />
        </div>
    </div>
    <div class="top">
    </div>
    <div class="bottom">
    </div>
</div>
<!--End .traffic-->
